<?php
/**
 * Created by PhpStorm.
 * User: root1
 * Date: 16/9/18
 * Time: 下午8:01
 */
require_once('./common.inc.php');

//loadconf('mobileapi/base');
//use Favorite\FavoriteBase;
//use Favorite\ArticleFavorite;
use Center\UserCoupon;

class t extends lib\core\Action
{

    public function doDefault()
    {
//        $rs = \Center\Article::getArticleById('AODAwMDAwMDAwMjg4');
//        $obj = new \Favorite\ArticleFavorite(\Favorite\FavoriteBase::TYPE_ARTICLE);
//        $rs = $obj->add(1, 'AODAwMDAwMDAwMjg4');
//        $r = sprintf('%02x', 581069 % 256);
//        pre($r);
//        $res = new \controls\MobileApi\Center\Article();
//        $rs = $res->getArticleExtInfo();
//        $rs = $res->getMyFavoriteArticle();
//        $rs = json_decode($rs);
//        $data = [
//
//        ];
//        $obj = Passport\Register::addUser(\Passport\Register::REG_TYPE_MOBILE, $data, );


//        var_dump($rs);
//        $shop = [
//            'CityId' => 430100,
//            'CateId' => 1,
//            'Name' => '付祥测试2',
//            'Cover' => 'http://img0.imgtn.bdimg.com/it/u=2595232249,1602986117&fm=27&gp=0.jpg',
//            'Description' => '付祥测试内容2222',
//            'Address' => '地址222222',
//            'Mobile' => 18670094956,
//            'Content' => '付祥测试内容222',
//            'UpdateTime' => '2018-01-23 00:00:23',
//        ];
//        $rs = \Center\Shop::add($shop);
//        pre($rs);
//
//        $data = [
//            'CityId' => 430100,
//            'ShopId' => 0,
//            'Name' => '夏佳测试活动',
//            'Cover' => 'http://img0.imgtn.bdimg.com/it/u=2595232249,1602986117&fm=27&gp=0.jpg',
//            'Description' => '夏佳测试活动',
//            'ViewCount' => 1,
//            'StartTime' => '2018-01-24 00:19:23',
//            'EndTime' => '2018-02-15 00:19:23',
//            'MinPrice' => '1.00',
//            'MaxPrice' => '3000.00',
//            'PriceType' => 2,
//            'Rules' => 'ttteeesstt',
//            'Status' => 1,
//            'UpdateTime' => '2018-01-24 00:19:23'
//        ];
//        $res = \Center\Active::add($data);
//        pre($res);
//        $rs = \Center\Active::update(5, ['Status' => \Center\Active::STATUS_FINISH]);
        $uid = 1;
        $shopid = 9;
//        $rs = $coupon = \Center\UserCoupon::getUserList($uid, 1, UserCoupon::COUPON_VALID, $shopid);
//        $rs = UserCoupon::update(9, ['Stock' => 10000]);
        //$rs = \Center\QrCode::getQrCodeUrl(1, 1, 1, 1);
        //$rs = \Center\User::getUserById(1);
//        $rs = \Center\VoteActive::update(1, ['Status' => 2]);
//        $rs = \Center\VoteActiveInfo::update(1, ['RewardStatus' => 1]);
//        $rs = \Center\CouponConfig::add(['ShopId' => 4,]);
//        $coupon_list = \Center\CouponConfig::getList(['ShopId' => 4]);
//        pre($coupon_list);
//        $rs = current($coupon_list);
//        $rs = \Center\Active::update(4, ['Status' => 2]);
//        $rs = \Center\Active::update(5, ['MaxOffer' => 200]);
//        $rs = \Center\ActiveOffer::getMyActivesOffers([5,4], 10);
//        $rs = Center\CoinLog::getRankList(1);
//        $rs = \Admin\SiteStatus::getStatisticList(103);
//        $rs = loadconf('wallet/desc');

        //$rs = Notice\Sys::addNotice(32, 1, $data);
//        $rs = \Notice\Sys::clearNotice(16, 2);
//        var_dump($rs);
//        $rs = \Notice\Sys::getNotice(16, 2);
//        pre($rs);
//        $rs = \Notice\AliSms::getLastSms(13517418228, 1);
//        $rs = \Passport\Account::isMobileExists(15364014717);
//        $rs = \Notice\AliSms::getLastSms(15364014717, 1);
//        $rs = \Notice\RedDot::getDot(16);
        //$rs = \Center\User::update(23, ['JCoin' => ['JCoin' => '+100']]);
//        $rs = \Center\Category::getAllCate();
//        $rs = \Center\ActiveOffer::getMyActivesOffers(1, 12);
//        $rs = \Center\CoinLog::addCoinLog(16, 3, \Center\CoinLog::TYPE_OTHER);
//        $rs = \Center\CoinLog::getRankList(1);
        //list($msec, $sec) = explode(' ', microtime());
        //$msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
//        $rs = \Center\Shop::getListByCityCatId(1, 4, 0, 20);
//        $now = date('Y-m-d H:i:s');
//        $adswhere = [
//            'Status' => 1,
////            'StartTime <=' => $now,
////            'EndTime >' => $now,
//        ];
//        $ads = \Center\Shop::getListByCityCatId(1, 4);
//        $rs = \Center\CoinLog::addCoinLog(16, 3, \Center\CoinLog::TYPE_OTHER);
//        $mc = \Common\Bridge::memcache(\Common\Bridge::MEMCACHE_DEFAULT);
//        $mc->delete('Ads_List:1');
//        $ads = Center\Category::getAllCate();
//        $rs = \Center\CoinLog::addCoinLog(47, 100, \Center\CoinLog::TYPE_OTHER);
//        var_dump($rs);
//        $uc = [
//            'UserId' => 72,
//            'CouponId' => 42,
//            'ShopId' => 3,
//            'Amount' => 1,
//            'Status' => 1,
//            'StartTime' => date('Y-m-d H:i:s'),
//            'EndTime' => date('Y-m-d H:i:s', strtotime('+7 day')),
//        ];
//        $rs = Center\UserCoupon::add($uc);
//        $res = \Center\ActiveOffer::getAllList(1);
//        $num = 1;
//        $rs = \Center\VoteActiveInfo::update(15, ['VoteNum' => ['VoteNum', '+' . $num]]);
//        var_dump($rs);
//        $res = \Center\VoteActive::getLastValidActive();
//        $rs = \Center\VoteActiveShop::getVoteShop($res['Id'], 0, 50);
        $rs = \Center\Shop::getInfoByIds(13);
        pre($rs);
    }
}
$app->run();